import { CustomerService } from './customer.service';
import { ApiTags, ApiOperation } from '@nestjs/swagger';
import { Body, Controller, Delete, Param, Post, Query, Req, HttpException } from '@nestjs/common';
import { CreateCustomerDto } from './dto/customer.dto';
@ApiTags('客户')
@Controller('customer')
export class CustomerController {
    constructor(private readonly customerService: CustomerService) {}

    /**
     * 创建客户信息
     */
    @ApiOperation({ summary:'创建客户信息' })
    @Post()
    async create(@Body() post:CreateCustomerDto, @Req() req){
        return this.customerService.create(post)
    }

     /**
     * 删除客户信息
     */
      @ApiOperation({ summary:'删除客户信息' })
      @Delete()
      async move(@Query('id') id:number){
          return this.customerService.remove(id)
      }

       /**
        * 更新客户信息
      */
        @ApiOperation({ summary:'更新客户信息' })
        @Post('/updateById')
        async update(@Query('id') id:number, @Body() post: CreateCustomerDto){
            return this.customerService.update(id, post)
        }
}
